﻿#include "ClientPackets.h"

namespace ClientPackets
{

    short ClientVersion::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ClientVersion);
    }

    void ClientVersion::ReadPacket(BinaryReader *reader)
    {
        VersionHash = reader->ReadBytes(reader->ReadInt32());
    }

    void ClientVersion::WritePacket(BinaryWriter *writer)
    {
        writer->Write(VersionHash.size());
        writer->Write(VersionHash);
    }

    short Disconnect::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Disconnect);
    }

    void Disconnect::ReadPacket(BinaryReader *reader)
    {
    }

    void Disconnect::WritePacket(BinaryWriter *writer)
    {
    }

    short KeepAlive::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::KeepAlive);
    }

    void KeepAlive::ReadPacket(BinaryReader *reader)
    {
        Time = reader->ReadInt64();
    }

    void KeepAlive::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Time);
    }

    short NewAccount::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::NewAccount);
    }

    void NewAccount::ReadPacket(BinaryReader *reader)
    {
        AccountID = reader->ReadString();
        Password = reader->ReadString();
        BirthDate = DateTime::FromBinary(reader->ReadInt64());
        UserName = reader->ReadString();
        SecretQuestion = reader->ReadString();
        SecretAnswer = reader->ReadString();
        EMailAddress = reader->ReadString();
    }

    void NewAccount::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AccountID);
        writer->Write(Password);
        writer->Write(BirthDate.ToBinary());
        writer->Write(UserName);
        writer->Write(SecretQuestion);
        writer->Write(SecretAnswer);
        writer->Write(EMailAddress);
    }

    short ChangePassword::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ChangePassword);
    }

    void ChangePassword::ReadPacket(BinaryReader *reader)
    {
        AccountID = reader->ReadString();
        CurrentPassword = reader->ReadString();
        NewPassword = reader->ReadString();
    }

    void ChangePassword::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AccountID);
        writer->Write(CurrentPassword);
        writer->Write(NewPassword);
    }

    short Login::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Login);
    }

    void Login::ReadPacket(BinaryReader *reader)
    {
        AccountID = reader->ReadString();
        Password = reader->ReadString();
    }

    void Login::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AccountID);
        writer->Write(Password);
    }

    short NewCharacter::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::NewCharacter);
    }

    void NewCharacter::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
        Gender = static_cast<MirGender>(reader->ReadByte());
        Class = static_cast<MirClass>(reader->ReadByte());
    }

    void NewCharacter::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
        writer->Write(static_cast<unsigned char>(Gender));
        writer->Write(static_cast<unsigned char>(Class));
    }

    short DeleteCharacter::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DeleteCharacter);
    }

    void DeleteCharacter::ReadPacket(BinaryReader *reader)
    {
        CharacterIndex = reader->ReadInt32();
    }

    void DeleteCharacter::WritePacket(BinaryWriter *writer)
    {
        writer->Write(CharacterIndex);
    }

    short StartGame::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::StartGame);
    }

    void StartGame::ReadPacket(BinaryReader *reader)
    {
        CharacterIndex = reader->ReadInt32();
    }

    void StartGame::WritePacket(BinaryWriter *writer)
    {
        writer->Write(CharacterIndex);
    }

    short LogOut::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::LogOut);
    }

    void LogOut::ReadPacket(BinaryReader *reader)
    {
    }

    void LogOut::WritePacket(BinaryWriter *writer)
    {
    }

    short Turn::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Turn);
    }

    void Turn::ReadPacket(BinaryReader *reader)
    {
        Direction = static_cast<MirDirection>(reader->ReadByte());
    }

    void Turn::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Direction));
    }

    short Walk::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Walk);
    }

    void Walk::ReadPacket(BinaryReader *reader)
    {
        Direction = static_cast<MirDirection>(reader->ReadByte());
    }

    void Walk::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Direction));
    }

    short Run::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Run);
    }

    void Run::ReadPacket(BinaryReader *reader)
    {
        Direction = static_cast<MirDirection>(reader->ReadByte());
    }

    void Run::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Direction));
    }

    short Chat::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Chat);
    }

    void Chat::ReadPacket(BinaryReader *reader)
    {
        Message = reader->ReadString();

        int count = reader->ReadInt32();

        for (int i = 0; i < count; i++)
        {
            ChatItem tempVar(reader);
            LinkedItems.push_back(&tempVar);
        }
    }

    void Chat::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Message);

        writer->Write(LinkedItems.size());

        for (int i = 0; i < LinkedItems.size(); i++)
        {
            LinkedItems[i]->Save(writer);
        }
    }

    short MoveItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MoveItem);
    }

    void MoveItem::ReadPacket(BinaryReader *reader)
    {
        Grid = static_cast<MirGridType>(reader->ReadByte());
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void MoveItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Grid));
        writer->Write(From);
        writer->Write(To);
    }

    short StoreItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::StoreItem);
    }

    void StoreItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void StoreItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short DepositRefineItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DepositRefineItem);
    }

    void DepositRefineItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void DepositRefineItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short RetrieveRefineItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RetrieveRefineItem);
    }

    void RetrieveRefineItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void RetrieveRefineItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short RefineCancel::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RefineCancel);
    }

    void RefineCancel::ReadPacket(BinaryReader *reader)
    {
    }

    void RefineCancel::WritePacket(BinaryWriter *writer)
    {
    }

    short RefineItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RefineItem);
    }

    void RefineItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void RefineItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short CheckRefine::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CheckRefine);
    }

    void CheckRefine::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void CheckRefine::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short ReplaceWedRing::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ReplaceWedRing);
    }

    void ReplaceWedRing::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void ReplaceWedRing::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short DepositTradeItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DepositTradeItem);
    }

    void DepositTradeItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void DepositTradeItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short RetrieveTradeItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RetrieveTradeItem);
    }

    void RetrieveTradeItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void RetrieveTradeItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short TakeBackItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TakeBackItem);
    }

    void TakeBackItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void TakeBackItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short MergeItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MergeItem);
    }

    void MergeItem::ReadPacket(BinaryReader *reader)
    {
        GridFrom = static_cast<MirGridType>(reader->ReadByte());
        GridTo = static_cast<MirGridType>(reader->ReadByte());
        IDFrom = reader->ReadUInt64();
        IDTo = reader->ReadUInt64();
    }

    void MergeItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(GridFrom));
        writer->Write(static_cast<unsigned char>(GridTo));
        writer->Write(IDFrom);
        writer->Write(IDTo);
    }

    short EquipItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::EquipItem);
    }

    void EquipItem::ReadPacket(BinaryReader *reader)
    {
        Grid = static_cast<MirGridType>(reader->ReadByte());
        UniqueID = reader->ReadUInt64();
        To = reader->ReadInt32();
    }

    void EquipItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Grid));
        writer->Write(UniqueID);
        writer->Write(To);
    }

    short RemoveItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RemoveItem);
    }

    void RemoveItem::ReadPacket(BinaryReader *reader)
    {
        Grid = static_cast<MirGridType>(reader->ReadByte());
        UniqueID = reader->ReadUInt64();
        To = reader->ReadInt32();
    }

    void RemoveItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Grid));
        writer->Write(UniqueID);
        writer->Write(To);
    }

    short RemoveSlotItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RemoveSlotItem);
    }

    void RemoveSlotItem::ReadPacket(BinaryReader *reader)
    {
        Grid = static_cast<MirGridType>(reader->ReadByte());
        GridTo = static_cast<MirGridType>(reader->ReadByte());
        UniqueID = reader->ReadUInt64();
        To = reader->ReadInt32();
        FromUniqueID = reader->ReadUInt64();
    }

    void RemoveSlotItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Grid));
        writer->Write(static_cast<unsigned char>(GridTo));
        writer->Write(UniqueID);
        writer->Write(To);
        writer->Write(FromUniqueID);
    }

    short SplitItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::SplitItem);
    }

    void SplitItem::ReadPacket(BinaryReader *reader)
    {
        Grid = static_cast<MirGridType>(reader->ReadByte());
        UniqueID = reader->ReadUInt64();
        Count = reader->ReadUInt16();
    }

    void SplitItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Grid));
        writer->Write(UniqueID);
        writer->Write(Count);
    }

    short UseItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::UseItem);
    }

    void UseItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void UseItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short DropItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DropItem);
    }

    void DropItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Count = reader->ReadUInt16();
    }

    void DropItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Count);
    }

    short DropGold::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DropGold);
    }

    void DropGold::ReadPacket(BinaryReader *reader)
    {
        Amount = reader->ReadUInt32();
    }

    void DropGold::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Amount);
    }

    short PickUp::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::PickUp);
    }

    void PickUp::ReadPacket(BinaryReader *reader)
    {
    }

    void PickUp::WritePacket(BinaryWriter *writer)
    {
    }

    short Inspect::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Inspect);
    }

    void Inspect::ReadPacket(BinaryReader *reader)
    {
        ObjectID = reader->ReadUInt32();
        Ranking = reader->ReadBoolean();
    }

    void Inspect::WritePacket(BinaryWriter *writer)
    {
        writer->Write(ObjectID);
        writer->Write(Ranking);
    }

    short ChangeAMode::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ChangeAMode);
    }

    void ChangeAMode::ReadPacket(BinaryReader *reader)
    {
        Mode = static_cast<AttackMode>(reader->ReadByte());
    }

    void ChangeAMode::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Mode));
    }

    short ChangePMode::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ChangePMode);
    }

    void ChangePMode::ReadPacket(BinaryReader *reader)
    {
        Mode = static_cast<PetMode>(reader->ReadByte());
    }

    void ChangePMode::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Mode));
    }

    short ChangeTrade::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ChangeTrade);
    }

    void ChangeTrade::ReadPacket(BinaryReader *reader)
    {
        AllowTrade = reader->ReadBoolean();
    }

    void ChangeTrade::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AllowTrade);
    }

    short Attack::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Attack);
    }

    void Attack::ReadPacket(BinaryReader *reader)
    {
        Direction = static_cast<MirDirection>(reader->ReadByte());
        Spell = static_cast<Spell>(reader->ReadByte());
    }

    void Attack::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Direction));
        writer->Write(static_cast<unsigned char>(Spell));
    }

    short RangeAttack::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RangeAttack);
    }

    void RangeAttack::ReadPacket(BinaryReader *reader)
    {
        Direction = static_cast<MirDirection>(reader->ReadByte());
        Location = new Point(reader->ReadInt32(), reader->ReadInt32());
        TargetID = reader->ReadUInt32();
        TargetLocation = new Point(reader->ReadInt32(), reader->ReadInt32());
    }

    void RangeAttack::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Direction));
        writer->Write(Location->X);
        writer->Write(Location->Y);
        writer->Write(TargetID);
        writer->Write(TargetLocation->X);
        writer->Write(TargetLocation->Y);
    }

    short Harvest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Harvest);
    }

    void Harvest::ReadPacket(BinaryReader *reader)
    {
        Direction = static_cast<MirDirection>(reader->ReadByte());
    }

    void Harvest::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Direction));
    }

    short CallNPC::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CallNPC);
    }

    void CallNPC::ReadPacket(BinaryReader *reader)
    {
        ObjectID = reader->ReadUInt32();
        Key = reader->ReadString();
    }

    void CallNPC::WritePacket(BinaryWriter *writer)
    {
        writer->Write(ObjectID);
        writer->Write(Key);
    }

    short BuyItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::BuyItem);
    }

    void BuyItem::ReadPacket(BinaryReader *reader)
    {
        ItemIndex = reader->ReadUInt64();
        Count = reader->ReadUInt16();
        Type = static_cast<PanelType>(reader->ReadByte());
    }

    void BuyItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(ItemIndex);
        writer->Write(Count);
        writer->Write(static_cast<unsigned char>(Type));
    }

    short SellItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::SellItem);
    }

    void SellItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Count = reader->ReadUInt16();
    }

    void SellItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Count);
    }

    short CraftItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CraftItem);
    }

    void CraftItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Count = reader->ReadUInt16();

        Slots = std::vector<int>(reader->ReadInt32());
        for (int i = 0; i < Slots.size(); i++)
        {
            Slots[i] = reader->ReadInt32();
        }
    }

    void CraftItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Count);

        writer->Write(Slots.size());
        for (int i = 0; i < Slots.size(); i++)
        {
            writer->Write(Slots[i]);
        }
    }

    short RepairItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RepairItem);
    }

    void RepairItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void RepairItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short BuyItemBack::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::BuyItemBack);
    }

    void BuyItemBack::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Count = reader->ReadUInt16();
    }

    void BuyItemBack::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Count);
    }

    short SRepairItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::SRepairItem);
    }

    void SRepairItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void SRepairItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short MagicKey::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MagicKey);
    }

    void MagicKey::ReadPacket(BinaryReader *reader)
    {
        Spell = static_cast<Spell>(reader->ReadByte());
        Key = reader->ReadByte();
    }

    void MagicKey::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Spell));
        writer->Write(Key);
    }

    short Magic::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Magic);
    }

    void Magic::ReadPacket(BinaryReader *reader)
    {
        Spell = static_cast<Spell>(reader->ReadByte());
        Direction = static_cast<MirDirection>(reader->ReadByte());
        TargetID = reader->ReadUInt32();
        Location = new Point(reader->ReadInt32(), reader->ReadInt32());
    }

    void Magic::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Spell));
        writer->Write(static_cast<unsigned char>(Direction));
        writer->Write(TargetID);
        writer->Write(Location->X);
        writer->Write(Location->Y);
    }

    short SwitchGroup::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::SwitchGroup);
    }

    void SwitchGroup::ReadPacket(BinaryReader *reader)
    {
        AllowGroup = reader->ReadBoolean();
    }

    void SwitchGroup::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AllowGroup);
    }

    short AddMember::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AddMember);
    }

    void AddMember::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
    }

    void AddMember::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
    }

    short DelMember::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DellMember);
    }

    void DelMember::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
    }

    void DelMember::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
    }

    short GroupInvite::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GroupInvite);
    }

    void GroupInvite::ReadPacket(BinaryReader *reader)
    {
        AcceptInvite = reader->ReadBoolean();
    }

    void GroupInvite::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AcceptInvite);
    }

    short MarriageRequest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarriageRequest);
    }

    void MarriageRequest::ReadPacket(BinaryReader *reader)
    {
    }

    void MarriageRequest::WritePacket(BinaryWriter *writer)
    {
    }

    short MarriageReply::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarriageReply);
    }

    void MarriageReply::ReadPacket(BinaryReader *reader)
    {
        AcceptInvite = reader->ReadBoolean();
    }

    void MarriageReply::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AcceptInvite);
    }

    short ChangeMarriage::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ChangeMarriage);
    }

    void ChangeMarriage::ReadPacket(BinaryReader *reader)
    {
    }

    void ChangeMarriage::WritePacket(BinaryWriter *writer)
    {
    }

    short DivorceRequest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DivorceRequest);
    }

    void DivorceRequest::ReadPacket(BinaryReader *reader)
    {
    }

    void DivorceRequest::WritePacket(BinaryWriter *writer)
    {
    }

    short DivorceReply::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DivorceReply);
    }

    void DivorceReply::ReadPacket(BinaryReader *reader)
    {
        AcceptInvite = reader->ReadBoolean();
    }

    void DivorceReply::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AcceptInvite);
    }

    short AddMentor::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AddMentor);
    }

    void AddMentor::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
    }

    void AddMentor::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
    }

    short MentorReply::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MentorReply);
    }

    void MentorReply::ReadPacket(BinaryReader *reader)
    {
        AcceptInvite = reader->ReadBoolean();
    }

    void MentorReply::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AcceptInvite);
    }

    short AllowMentor::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AllowMentor);
    }

    void AllowMentor::ReadPacket(BinaryReader *reader)
    {
    }

    void AllowMentor::WritePacket(BinaryWriter *writer)
    {
    }

    short CancelMentor::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CancelMentor);
    }

    void CancelMentor::ReadPacket(BinaryReader *reader)
    {
    }

    void CancelMentor::WritePacket(BinaryWriter *writer)
    {
    }

    short TradeReply::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TradeReply);
    }

    void TradeReply::ReadPacket(BinaryReader *reader)
    {
        AcceptInvite = reader->ReadBoolean();
    }

    void TradeReply::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AcceptInvite);
    }

    short TradeRequest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TradeRequest);
    }

    void TradeRequest::ReadPacket(BinaryReader *reader)
    {
    }

    void TradeRequest::WritePacket(BinaryWriter *writer)
    {
    }

    short TradeGold::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TradeGold);
    }

    void TradeGold::ReadPacket(BinaryReader *reader)
    {
        Amount = reader->ReadUInt32();
    }

    void TradeGold::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Amount);
    }

    short TradeConfirm::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TradeConfirm);
    }

    void TradeConfirm::ReadPacket(BinaryReader *reader)
    {
        Locked = reader->ReadBoolean();
    }

    void TradeConfirm::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Locked);
    }

    short TradeCancel::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TradeCancel);
    }

    void TradeCancel::ReadPacket(BinaryReader *reader)
    {
    }

    void TradeCancel::WritePacket(BinaryWriter *writer)
    {
    }

    short TownRevive::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::TownRevive);
    }

    void TownRevive::ReadPacket(BinaryReader *reader)
    {
    }

    void TownRevive::WritePacket(BinaryWriter *writer)
    {
    }

    short SpellToggle::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::SpellToggle);
    }

    void SpellToggle::ReadPacket(BinaryReader *reader)
    {
        Spell = static_cast<Spell>(reader->ReadByte());
        CanUse = reader->ReadBoolean();
    }

    void SpellToggle::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Spell));
        writer->Write(CanUse);
    }

    short ConsignItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ConsignItem);
    }

    void ConsignItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Price = reader->ReadUInt32();
        Type = static_cast<MarketPanelType>(reader->ReadByte());
    }

    void ConsignItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Price);
        writer->Write(static_cast<unsigned char>(Type));
    }

    short MarketSearch::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarketSearch);
    }

    void MarketSearch::ReadPacket(BinaryReader *reader)
    {
        Match = reader->ReadString();
        Type = static_cast<ItemType>(reader->ReadByte());
        Usermode = reader->ReadBoolean();
        MinShape = reader->ReadInt16();
        MaxShape = reader->ReadInt16();
        MarketType = static_cast<MarketPanelType>(reader->ReadByte());
    }

    void MarketSearch::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Match);
        writer->Write(static_cast<unsigned char>(Type));
        writer->Write(Usermode);
        writer->Write(MinShape);
        writer->Write(MaxShape);
        writer->Write(static_cast<unsigned char>(MarketType));
    }

    short MarketRefresh::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarketRefresh);
    }

    void MarketRefresh::ReadPacket(BinaryReader *reader)
    {
    }

    void MarketRefresh::WritePacket(BinaryWriter *writer)
    {
    }

    short MarketPage::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarketPage);
    }

    void MarketPage::ReadPacket(BinaryReader *reader)
    {
        Page = reader->ReadInt32();
    }

    void MarketPage::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Page);
    }

    short MarketBuy::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarketBuy);
    }

    void MarketBuy::ReadPacket(BinaryReader *reader)
    {
        AuctionID = reader->ReadUInt64();
        BidPrice = reader->ReadUInt32();
    }

    void MarketBuy::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AuctionID);
        writer->Write(BidPrice);
    }

    short MarketSellNow::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarketSellNow);
    }

    void MarketSellNow::ReadPacket(BinaryReader *reader)
    {
        AuctionID = reader->ReadUInt64();
    }

    void MarketSellNow::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AuctionID);
    }

    short MarketGetBack::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MarketGetBack);
    }

    void MarketGetBack::ReadPacket(BinaryReader *reader)
    {
        AuctionID = reader->ReadUInt64();
    }

    void MarketGetBack::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AuctionID);
    }

    short RequestUserName::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RequestUserName);
    }

    void RequestUserName::ReadPacket(BinaryReader *reader)
    {
        UserID = reader->ReadUInt32();
    }

    void RequestUserName::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UserID);
    }

    short RequestChatItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RequestChatItem);
    }

    void RequestChatItem::ReadPacket(BinaryReader *reader)
    {
        ChatItemID = reader->ReadUInt64();
    }

    void RequestChatItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(ChatItemID);
    }

    short EditGuildMember::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::EditGuildMember);
    }

    void EditGuildMember::ReadPacket(BinaryReader *reader)
    {
        ChangeType = reader->ReadByte();
        RankIndex = reader->ReadByte();
        Name = reader->ReadString();
        RankName = reader->ReadString();
    }

    void EditGuildMember::WritePacket(BinaryWriter *writer)
    {
        writer->Write(ChangeType);
        writer->Write(RankIndex);
        writer->Write(Name);
        writer->Write(RankName);
    }

    short EditGuildNotice::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::EditGuildNotice);
    }

    void EditGuildNotice::ReadPacket(BinaryReader *reader)
    {
        int LineCount = reader->ReadInt32();
        for (int i = 0; i < LineCount; i++)
        {
            notice.push_back(reader->ReadString());
        }
    }

    void EditGuildNotice::WritePacket(BinaryWriter *writer)
    {
        writer->Write(notice.size());
        for (int i = 0; i < notice.size(); i++)
        {
            writer->Write(notice[i]);
        }
    }

    short GuildInvite::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GuildInvite);
    }

    void GuildInvite::ReadPacket(BinaryReader *reader)
    {
        AcceptInvite = reader->ReadBoolean();
    }

    void GuildInvite::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AcceptInvite);
    }

    short RequestGuildInfo::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RequestGuildInfo);
    }

    void RequestGuildInfo::ReadPacket(BinaryReader *reader)
    {
        Type = reader->ReadByte();
    }

    void RequestGuildInfo::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Type);
    }

    short GuildNameReturn::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GuildNameReturn);
    }

    void GuildNameReturn::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
    }

    void GuildNameReturn::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
    }

    short GuildWarReturn::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GuildWarReturn);
    }

    void GuildWarReturn::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
    }

    void GuildWarReturn::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
    }

    short GuildStorageGoldChange::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GuildStorageGoldChange);
    }

    void GuildStorageGoldChange::ReadPacket(BinaryReader *reader)
    {
        Type = reader->ReadByte();
        Amount = reader->ReadUInt32();
    }

    void GuildStorageGoldChange::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Type);
        writer->Write(Amount);
    }

    short GuildStorageItemChange::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GuildStorageItemChange);
    }

    void GuildStorageItemChange::ReadPacket(BinaryReader *reader)
    {
        Type = reader->ReadByte();
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void GuildStorageItemChange::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Type);
        writer->Write(From);
        writer->Write(To);
    }

    short EquipSlotItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::EquipSlotItem);
    }

    void EquipSlotItem::ReadPacket(BinaryReader *reader)
    {
        Grid = static_cast<MirGridType>(reader->ReadByte());
        UniqueID = reader->ReadUInt64();
        To = reader->ReadInt32();
        GridTo = static_cast<MirGridType>(reader->ReadByte());
        ToUniqueID = reader->ReadUInt64();
    }

    void EquipSlotItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(static_cast<unsigned char>(Grid));
        writer->Write(UniqueID);
        writer->Write(To);
        writer->Write(static_cast<unsigned char>(GridTo));
        writer->Write(ToUniqueID);
    }

    short FishingCast::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::FishingCast);
    }

    void FishingCast::ReadPacket(BinaryReader *reader)
    {
        CastOut = reader->ReadBoolean();
    }

    void FishingCast::WritePacket(BinaryWriter *writer)
    {
        writer->Write(CastOut);
    }

    short FishingChangeAutocast::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::FishingChangeAutocast);
    }

    void FishingChangeAutocast::ReadPacket(BinaryReader *reader)
    {
        AutoCast = reader->ReadBoolean();
    }

    void FishingChangeAutocast::WritePacket(BinaryWriter *writer)
    {
        writer->Write(AutoCast);
    }

    short AcceptQuest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AcceptQuest);
    }

    void AcceptQuest::ReadPacket(BinaryReader *reader)
    {
        NPCIndex = reader->ReadUInt32();
        QuestIndex = reader->ReadInt32();
    }

    void AcceptQuest::WritePacket(BinaryWriter *writer)
    {
        writer->Write(NPCIndex);
        writer->Write(QuestIndex);
    }

    short FinishQuest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::FinishQuest);
    }

    void FinishQuest::ReadPacket(BinaryReader *reader)
    {
        QuestIndex = reader->ReadInt32();
        SelectedItemIndex = reader->ReadInt32();
    }

    void FinishQuest::WritePacket(BinaryWriter *writer)
    {
        writer->Write(QuestIndex);
        writer->Write(SelectedItemIndex);
    }

    short AbandonQuest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AbandonQuest);
    }

    void AbandonQuest::ReadPacket(BinaryReader *reader)
    {
        QuestIndex = reader->ReadInt32();
    }

    void AbandonQuest::WritePacket(BinaryWriter *writer)
    {
        writer->Write(QuestIndex);
    }

    short ShareQuest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ShareQuest);
    }

    void ShareQuest::ReadPacket(BinaryReader *reader)
    {
        QuestIndex = reader->ReadInt32();
    }

    void ShareQuest::WritePacket(BinaryWriter *writer)
    {
        writer->Write(QuestIndex);
    }

    short AcceptReincarnation::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AcceptReincarnation);
    }

    void AcceptReincarnation::ReadPacket(BinaryReader *reader)
    {
    }

    void AcceptReincarnation::WritePacket(BinaryWriter *writer)
    {
    }

    short CancelReincarnation::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CancelReincarnation);
    }

    void CancelReincarnation::ReadPacket(BinaryReader *reader)
    {
    }

    void CancelReincarnation::WritePacket(BinaryWriter *writer)
    {
    }

    short CombineItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CombineItem);
    }

    void CombineItem::ReadPacket(BinaryReader *reader)
    {
        IDFrom = reader->ReadUInt64();
        IDTo = reader->ReadUInt64();
    }

    void CombineItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(IDFrom);
        writer->Write(IDTo);
    }

    short AwakeningNeedMaterials::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AwakeningNeedMaterials);
    }

    void AwakeningNeedMaterials::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Type = static_cast<AwakeType>(reader->ReadByte());
    }

    void AwakeningNeedMaterials::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(static_cast<unsigned char>(Type));
    }

    short AwakeningLockedItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AwakeningLockedItem);
    }

    void AwakeningLockedItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Locked = reader->ReadBoolean();
    }

    void AwakeningLockedItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Locked);
    }

    short Awakening::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Awakening);
    }

    void Awakening::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Type = static_cast<AwakeType>(reader->ReadByte());
        PositionIdx = reader->ReadUInt32();
    }

    void Awakening::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(static_cast<unsigned char>(Type));
        writer->Write(PositionIdx);
    }

    short DisassembleItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DisassembleItem);
    }

    void DisassembleItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void DisassembleItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short DowngradeAwakening::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DowngradeAwakening);
    }

    void DowngradeAwakening::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void DowngradeAwakening::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short ResetAddedItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ResetAddedItem);
    }

    void ResetAddedItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
    }

    void ResetAddedItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
    }

    short SendMail::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::SendMail);
    }

    void SendMail::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
        Message = reader->ReadString();
        Gold = reader->ReadUInt32();

        for (int i = 0; i < 5; i++)
        {
            ItemsIdx[i] = reader->ReadUInt64();
        }

        Stamped = reader->ReadBoolean();
    }

    void SendMail::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
        writer->Write(Message);
        writer->Write(Gold);

        for (int i = 0; i < 5; i++)
        {
            writer->Write(ItemsIdx[i]);
        }

        writer->Write(Stamped);
    }

    short ReadMail::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ReadMail);
    }

    void ReadMail::ReadPacket(BinaryReader *reader)
    {
        MailID = reader->ReadUInt64();
    }

    void ReadMail::WritePacket(BinaryWriter *writer)
    {
        writer->Write(MailID);
    }

    short CollectParcel::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CollectParcel);
    }

    void CollectParcel::ReadPacket(BinaryReader *reader)
    {
        MailID = reader->ReadUInt64();
    }

    void CollectParcel::WritePacket(BinaryWriter *writer)
    {
        writer->Write(MailID);
    }

    short DeleteMail::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DeleteMail);
    }

    void DeleteMail::ReadPacket(BinaryReader *reader)
    {
        MailID = reader->ReadUInt64();
    }

    void DeleteMail::WritePacket(BinaryWriter *writer)
    {
        writer->Write(MailID);
    }

    short LockMail::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::LockMail);
    }

    void LockMail::ReadPacket(BinaryReader *reader)
    {
        MailID = reader->ReadUInt64();
        Lock = reader->ReadBoolean();
    }

    void LockMail::WritePacket(BinaryWriter *writer)
    {
        writer->Write(MailID);
        writer->Write(Lock);
    }

    short MailLockedItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MailLockedItem);
    }

    void MailLockedItem::ReadPacket(BinaryReader *reader)
    {
        UniqueID = reader->ReadUInt64();
        Locked = reader->ReadBoolean();
    }

    void MailLockedItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(UniqueID);
        writer->Write(Locked);
    }

    short MailCost::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::MailCost);
    }

    void MailCost::ReadPacket(BinaryReader *reader)
    {
        Gold = reader->ReadUInt32();

        for (int i = 0; i < 5; i++)
        {
            ItemsIdx[i] = reader->ReadUInt64();
        }

        Stamped = reader->ReadBoolean();
    }

    void MailCost::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Gold);

        for (int i = 0; i < 5; i++)
        {
            writer->Write(ItemsIdx[i]);
        }

        writer->Write(Stamped);
    }

    short RequestIntelligentCreatureUpdates::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RequestIntelligentCreatureUpdates);
    }

    void RequestIntelligentCreatureUpdates::ReadPacket(BinaryReader *reader)
    {
        Update = reader->ReadBoolean();
    }

    void RequestIntelligentCreatureUpdates::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Update);
    }

    short UpdateIntelligentCreature::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::UpdateIntelligentCreature);
    }

    void UpdateIntelligentCreature::ReadPacket(BinaryReader *reader)
    {
        Creature = new ClientIntelligentCreature(reader);
        SummonMe = reader->ReadBoolean();
        UnSummonMe = reader->ReadBoolean();
        ReleaseMe = reader->ReadBoolean();
    }

    void UpdateIntelligentCreature::WritePacket(BinaryWriter *writer)
    {
        Creature->Save(writer);
        writer->Write(SummonMe);
        writer->Write(UnSummonMe);
        writer->Write(ReleaseMe);
    }

    short IntelligentCreaturePickup::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::IntelligentCreaturePickup);
    }

    void IntelligentCreaturePickup::ReadPacket(BinaryReader *reader)
    {
        MouseMode = reader->ReadBoolean();
        Location->X = reader->ReadInt32();
        Location->Y = reader->ReadInt32();
    }

    void IntelligentCreaturePickup::WritePacket(BinaryWriter *writer)
    {
        writer->Write(MouseMode);
        writer->Write(Location->X);
        writer->Write(Location->Y);
    }

    short AddFriend::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AddFriend);
    }

    void AddFriend::ReadPacket(BinaryReader *reader)
    {
        Name = reader->ReadString();
        Blocked = reader->ReadBoolean();
    }

    void AddFriend::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Name);
        writer->Write(Blocked);
    }

    short RemoveFriend::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RemoveFriend);
    }

    void RemoveFriend::ReadPacket(BinaryReader *reader)
    {
        CharacterIndex = reader->ReadInt32();
    }

    void RemoveFriend::WritePacket(BinaryWriter *writer)
    {
        writer->Write(CharacterIndex);
    }

    short RefreshFriends::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RefreshFriends);
    }

    void RefreshFriends::ReadPacket(BinaryReader *reader)
    {
    }

    void RefreshFriends::WritePacket(BinaryWriter *writer)
    {
    }

    short AddMemo::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::AddMemo);
    }

    void AddMemo::ReadPacket(BinaryReader *reader)
    {
        CharacterIndex = reader->ReadInt32();
        Memo = reader->ReadString();
    }

    void AddMemo::WritePacket(BinaryWriter *writer)
    {
        writer->Write(CharacterIndex);
        writer->Write(Memo);
    }

    short GuildBuffUpdate::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GuildBuffUpdate);
    }

    void GuildBuffUpdate::ReadPacket(BinaryReader *reader)
    {
        Action = reader->ReadByte();
        Id = reader->ReadInt32();
    }

    void GuildBuffUpdate::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Action);
        writer->Write(Id);
    }

    short GameshopBuy::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GameshopBuy);
    }

    void GameshopBuy::ReadPacket(BinaryReader *reader)
    {
        GIndex = reader->ReadInt32();
        Quantity = reader->ReadByte();
    }

    void GameshopBuy::WritePacket(BinaryWriter *writer)
    {
        writer->Write(GIndex);
        writer->Write(Quantity);
    }

    short NPCConfirmInput::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::NPCConfirmInput);
    }

    void NPCConfirmInput::ReadPacket(BinaryReader *reader)
    {
        NPCID = reader->ReadUInt32();
        PageName = reader->ReadString();
        Value = reader->ReadString();
    }

    void NPCConfirmInput::WritePacket(BinaryWriter *writer)
    {
        writer->Write(NPCID);
        writer->Write(PageName);
        writer->Write(Value);
    }

    short ReportIssue::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ReportIssue);
    }

    void ReportIssue::ReadPacket(BinaryReader *reader)
    {
        Image = reader->ReadBytes(reader->ReadInt32());
        ImageSize = reader->ReadInt32();
        ImageChunk = reader->ReadInt32();
    }

    void ReportIssue::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Image.size());
        writer->Write(Image);
        writer->Write(ImageSize);
        writer->Write(ImageChunk);
    }

    short GetRanking::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GetRanking);
    }

    void GetRanking::ReadPacket(BinaryReader *reader)
    {
        RankIndex = reader->ReadByte();
    }

    void GetRanking::WritePacket(BinaryWriter *writer)
    {
        writer->Write(RankIndex);
    }

    short Opendoor::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::Opendoor);
    }

    void Opendoor::ReadPacket(BinaryReader *reader)
    {
        DoorIndex = reader->ReadByte();
    }

    void Opendoor::WritePacket(BinaryWriter *writer)
    {
        writer->Write(DoorIndex);
    }

    short GetRentedItems::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::GetRentedItems);
    }

    void GetRentedItems::ReadPacket(BinaryReader *reader)
    {
    }

    void GetRentedItems::WritePacket(BinaryWriter *writer)
    {
    }

    short ItemRentalRequest::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ItemRentalRequest);
    }

    void ItemRentalRequest::ReadPacket(BinaryReader *reader)
    {
    }

    void ItemRentalRequest::WritePacket(BinaryWriter *writer)
    {
    }

    short ItemRentalFee::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ItemRentalFee);
    }

    void ItemRentalFee::ReadPacket(BinaryReader *reader)
    {
        Amount = reader->ReadUInt32();
    }

    void ItemRentalFee::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Amount);
    }

    short ItemRentalPeriod::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ItemRentalPeriod);
    }

    void ItemRentalPeriod::ReadPacket(BinaryReader *reader)
    {
        Days = reader->ReadUInt32();
    }

    void ItemRentalPeriod::WritePacket(BinaryWriter *writer)
    {
        writer->Write(Days);
    }

    short DepositRentalItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::DepositRentalItem);
    }

    void DepositRentalItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void DepositRentalItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short RetrieveRentalItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::RetrieveRentalItem);
    }

    void RetrieveRentalItem::ReadPacket(BinaryReader *reader)
    {
        From = reader->ReadInt32();
        To = reader->ReadInt32();
    }

    void RetrieveRentalItem::WritePacket(BinaryWriter *writer)
    {
        writer->Write(From);
        writer->Write(To);
    }

    short CancelItemRental::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::CancelItemRental);
    }

    void CancelItemRental::ReadPacket(BinaryReader *reader)
    {
    }

    void CancelItemRental::WritePacket(BinaryWriter *writer)
    {
    }

    short ItemRentalLockFee::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ItemRentalLockFee);
    }

    void ItemRentalLockFee::ReadPacket(BinaryReader *reader)
    {
    }

    void ItemRentalLockFee::WritePacket(BinaryWriter *writer)
    {
    }

    short ItemRentalLockItem::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ItemRentalLockItem);
    }

    void ItemRentalLockItem::ReadPacket(BinaryReader *reader)
    {
    }

    void ItemRentalLockItem::WritePacket(BinaryWriter *writer)
    {
    }

    short ConfirmItemRental::getIndex() const
    {
        return static_cast<short>(ClientPacketIds::ConfirmItemRental);
    }

    void ConfirmItemRental::ReadPacket(BinaryReader *reader)
    {
    }

    void ConfirmItemRental::WritePacket(BinaryWriter *writer)
    {
    }
}
